home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume4 / apml / part05 < prev    next >
Encoding:
Internet Message Format  |  1989-02-03  |  34.3 KB

  1. Path: xanth!mcnc!gatech!ukma!cwjcc!hal!ncoast!allbery
  2. From: ljz@fxgrp.UUCP (Lloyd Zusman)
  3. Newsgroups: comp.sources.misc
  4. Subject: v04i115: Arbitrary Precision Math Library -- 5 of 5
  5. Message-ID: <8810051945.AA05759@fxgrp.fx.com>
  6. Date: 7 Oct 88 00:12:40 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Reply-To: ljz@fxgrp.UUCP (Lloyd Zusman)
  9. Lines: 1053
  10. Approved: allbery@ncoast.UUCP
  11.  
  12. Posting-number: Volume 4, Issue 115
  13. Submitted-by: "Lloyd Zusman" <ljz@fxgrp.UUCP>
  14. Archive-name: apml/Part5
  15.  
  16. Enclosed you will find the Arbitrary Precision Math Library (5 of 5)
  17.  
  18. Please post this to the comp.sources.misc newsgroup.
  19.  
  20. I finally got this into good enough shape to send out to the net. To use,
  21. just unshar the 5 pieces, read the README file, possibly alter the makefiles
  22. to conform to your system's conventions, and then type 'make test'.
  23.  
  24. Good luck!
  25.  
  26. --
  27.   Lloyd Zusman                  Internet:  ljz@fx.com
  28.   Master Byte Software                  or ljz%fx.com@ames.arc.nasa.gov
  29.   Los Gatos, California                 or fxgrp!ljz@ames.arc.nasa.gov
  30.   "We take things well in hand."    uucp:  ...!ames!fxgrp!ljz
  31.   [ our Internet connection is down: use uucp or mail to the entry above it ]
  32.  
  33. #--------------------------Cut Here--------------------------
  34. #! /bin/sh
  35. # This is a shell archive.  Remove anything before the "#! /bin/sh" line,
  36. # then unpack it by saving it in a file and typing "sh file."
  37. #
  38. # Wrapped by Lloyd Zusman (ljz) at fxgrp on Wed Oct  5 12:41:51 1988
  39. #
  40. # unpacks with default permissions
  41. #
  42. # Contents : apm.h apmlocal.h test/Makefile test/makefile.msc
  43. #    test/apmtest.c
  44. #
  45. if `test ! -s apm.h`
  46. then
  47. echo "x - apm.h"
  48. sed 's/^X//' > apm.h << '@\END_OF_FILE_apm.h'
  49. X/******************************************************************************
  50. X
  51. X    Arbitrary Precision Math Library General Public License
  52. X            (Written October 5, 1988)
  53. X
  54. X Copyright (C) 1988 Lloyd Zusman, Master Byte Software, Los
  55. X Gatos, California.  Everyone is permitted to copy and distribute
  56. X verbatim copies of this license, but changing it is not allowed.
  57. X You can also use this wording to make the terms for other programs.
  58. X
  59. X The wording of this license is based on that of the
  60. X "GNU EMACS GENERAL PUBLIC LICENSE" by Richard Stallman,
  61. X Copyright (C) 1985, 1987, 1988, version of February 11, 1988,
  62. X but since some of the text has been changed, please be sure to
  63. X READ THIS CAREFULLY!
  64. X
  65. X  This general public license is intended to give everyone the right
  66. Xto share the Arbitrary Precision Math Library (hereinafter referred to
  67. Xas the "APM Library").  To make sure that you get the rights we want
  68. Xyou to have, I need to make restrictions that forbid anyone to deny
  69. Xyou these rights or to ask you to surrender the rights.
  70. X
  71. X  Specifically, we want to make sure that you have the right to give
  72. Xaway copies of the APM Library, that you receive source code or else
  73. Xcan get it if you want it, that you can change the APM Library or use
  74. Xpieces of it in new programs, and that you know you can do these
  75. Xthings.
  76. X
  77. X  To make sure that everyone has such rights, we have to forbid you to
  78. Xdeprive anyone else of these rights.  For example, if you distribute
  79. Xcopies of the APM Library, you must give the recipients all the
  80. Xrights that you have.  You must make sure that they, too, receive or
  81. Xcan get the source code.  And you must tell them their rights.
  82. X
  83. X  Also, for our own protection, we must make certain that everyone
  84. Xfinds out that there is no warranty for the APM Library.  If the APM
  85. XLibrary is modified by someone else and passed on, we want its
  86. Xrecipients to know that what they have is not what we distributed, so
  87. Xthat any problems introduced by others will not reflect on our
  88. Xreputation.
  89. X
  90. X  Therefore we (Lloyd Zusman and Master Byte Software) make the
  91. Xfollowing terms which say what you must do to be allowed to
  92. Xdistribute or change the APM Library.
  93. X
  94. X            COPYING POLICIES
  95. X
  96. X1. You may copy and distribute verbatim copies of the APM Library
  97. Xsource code as you receive it, in any medium, provided that you
  98. Xconspicuously and appropriately publish on each copy a valid copyright
  99. Xnotice "Copyright (C) 1988 Lloyd Zusman, Master Byte Software, Los
  100. XGatos, California" (or with whatever year is appropriate); keep intact
  101. Xthe notices on all files that refer to this License Agreement and to
  102. Xthe absence of any warranty; and give any other recipients of the the
  103. XAPM Library program a copy of this License Agreement along with the
  104. Xprogram.  You may charge a distribution fee for the physical act of
  105. Xtransferring a copy.
  106. X
  107. X  2. You may modify your copy or copies of the APM Library source code or
  108. Xany portion of it, and copy and distribute such modifications under
  109. Xthe terms of Paragraph 1 above, provided that you also do the following:
  110. X
  111. X    a) cause the modified files to carry prominent notices stating
  112. X    that you changed the files and the date of any change; and
  113. X
  114. X    b) cause the whole of any work that you distribute or publish, that in
  115. X    whole or in part contains or is a derivative of the APM Library or any
  116. X    part thereof, to be licensed to all third parties on terms identical
  117. X    to those contained in this License Agreement (except that you may
  118. X    choose to grant more extensive warranty protection to some or all
  119. X    third parties, at your option).
  120. X
  121. X    c) You may charge a distribution fee for the physical act of
  122. X    transferring a copy, and you may at your option offer warranty
  123. X    protection in exchange for a fee.
  124. X
  125. X    d) You may not charge a license fee for the whole of any work that
  126. X    you distribute or publish, that in whole or in part contains or is
  127. X    a derivative of the APM library or any part thereof, without the
  128. X    express written permission of Lloyd Zusman and Master Byte Software;
  129. X    whether this permission is granted for free or in return for goods
  130. X    services, royalties, or other compensation will be determined
  131. X    solely by Lloyd Zusman and Master Byte Software.
  132. X
  133. XMere aggregation of another unrelated program with this program (or its
  134. Xderivative) on a volume of a storage or distribution medium does not bring
  135. Xthe other program under the scope of these terms.
  136. X
  137. X  3. You may copy and distribute the APM Library (or a portion or
  138. Xderivative of it, under Paragraph 2) in object code or executable form
  139. Xunder all the terms of Paragraphs 1 and 2 above provided that you also
  140. Xdo one of the following:
  141. X
  142. X    a) accompany it with the complete corresponding machine-readable
  143. X    source code, which must be distributed under the terms of
  144. X    Paragraphs 1 and 2 above; or,
  145. X
  146. X    b) accompany it with a written offer, valid for at least three
  147. X    years, to give any third party free (except for a nominal
  148. X    shipping charge) a complete machine-readable copy of the
  149. X    corresponding source code, to be distributed under the terms of
  150. X    Paragraphs 1 and 2 above; or,
  151. X
  152. X    c) accompany it with the information you received as to where the
  153. X    corresponding source code may be obtained.  (This alternative is
  154. X    allowed only for noncommercial distribution and only if you
  155. X    received the program in object code or executable form alone.)
  156. X
  157. XFor an executable file, complete source code means all the source code
  158. Xfor all modules it contains; but, as a special exception, it need not
  159. Xinclude source code for modules which are standard libraries that
  160. Xaccompany the operating system on which the executable file runs.
  161. X
  162. X  4. You may not copy, sublicense, distribute or transfer the APM
  163. XLibrary except as expressly provided under this License Agreement.
  164. XAny attempt otherwise to copy, sublicense, distribute or transfer the
  165. XAPM Library is void and your rights to use the APM Library under this
  166. XLicense agreement shall be automatically terminated.  However, parties
  167. Xwho have received computer software programs from you with this
  168. XLicense Agreement will not have their licenses terminated so long as
  169. Xsuch parties remain in full compliance.
  170. X
  171. X  5. If you wish to incorporate parts of the APM Library into other
  172. Xprograms whose distribution conditions are different, write to Lloyd
  173. XZusman at Master Byte Software.  We have not yet worked out a simple
  174. Xrule that can be stated here, but we will often permit this.  We will
  175. Xbe guided by the goals of (1) preserving the free status of all
  176. Xderivatives of our free software; of (2) promoting the sharing and
  177. Xreuse of software; and of (3) not allowing anyone to profit from the
  178. Xuse of our software without us also having the opportunity to share
  179. Xin these profits.
  180. X
  181. XYour comments and suggestions about our licensing policies and our
  182. Xsoftware are welcome!  Please contact Lloyd Zusman, Master Byte
  183. XSoftware, 127 Wilder Ave., Los Gatos, California 95030, or call
  184. X(408) 395-5693.
  185. X
  186. X               NO WARRANTY
  187. X
  188. X  BECAUSE THE APM LIBRARY IS LICENSED FREE OF CHARGE, WE PROVIDE
  189. XABSOLUTELY NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE
  190. XLAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING, MASTER BYTE SOFTWARE,
  191. XLLOYD ZUSMAN AND/OR OTHER PARTIES PROVIDE THE APM LIBRARY "AS IS"
  192. XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  193. XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  194. XFITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  195. XAND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE THE APM
  196. XLIBRARY PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  197. XSERVICING, REPAIR OR CORRECTION.
  198. X
  199. X  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL MASTER BYTE
  200. XSOFTWARE, LLOYD ZUSMAN, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND
  201. XREDISTRIBUTE THE APM LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  202. XDAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL,
  203. XINCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  204. XINABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  205. XBEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
  206. XFAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
  207. XMASTER BYTE SOFTWARE) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF
  208. XTHE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  209. X
  210. X******************************************************************************/
  211. X
  212. X
  213. X/*
  214. X * Exported header file for the APM library.
  215. X *
  216. X * $Log:    apm.h,v $
  217. X * Revision 1.0  88/10/05  12:38:09  ljz
  218. X * Initial release.
  219. X * 
  220. X */
  221. X
  222. X#ifndef APM_H_INCLUDED
  223. X#define APM_H_INCLUDED
  224. X
  225. X/*
  226. X * Defining MSC implies MSDOS.
  227. X * Defining TURBOC implies MSDOS.
  228. X * Defining MSDOS alone implies unknown MSDOS C compiler.
  229. X * Defining MSC undefines TURBOC.
  230. X * Defining TURBOC undefines MSC.
  231. X * MSDOS undefined implies Unix.
  232. X */
  233. X
  234. X#ifdef MSC
  235. X# ifndef MSDOS
  236. X#  define MSDOS
  237. X# endif /* ! MSDOS */
  238. X# ifdef TURBOC
  239. X#  undef TURBOC
  240. X# endif /* TURBOC */
  241. X#endif /* MSC */
  242. X
  243. X#ifdef TURBOC
  244. X# ifndef MSDOS
  245. X#  define MSDOS
  246. X# endif /* ! MSDOS */
  247. X# ifdef MSC
  248. X#  undef MSC
  249. X# endif /* MSC */
  250. X#endif /* TURBOC */
  251. X
  252. X#ifdef MSC
  253. X# include <malloc.h>
  254. X#endif /* MSC */
  255. X
  256. Xstruct apm_struct {
  257. X    unsigned long magic;
  258. X    int alloclen;
  259. X    int length;
  260. X    int dp;
  261. X    short sign;
  262. X    short base;
  263. X    short *data;
  264. X};
  265. X
  266. Xtypedef struct apm_struct *APM;
  267. X
  268. Xextern int apm_errno;
  269. X
  270. Xextern int APM_line;
  271. Xextern char *APM_file;
  272. Xextern char *APM_func_name;
  273. X
  274. Xextern APM apm_init();
  275. Xextern int apm_dispose();
  276. Xextern int apm_add();
  277. Xextern int apm_subtract();
  278. Xextern int apm_multiply();
  279. Xextern int apm_divide();
  280. Xextern int apm_compare();
  281. Xextern int apm_compare_long();
  282. Xextern int apm_sign();
  283. Xextern int apm_absolute_value();
  284. Xextern int apm_negate();
  285. Xextern int apm_reciprocal();
  286. Xextern int apm_scale();
  287. Xextern int apm_round();
  288. Xextern int apm_validate();
  289. Xextern int apm_assign();
  290. Xextern int apm_assign_long();
  291. Xextern int apm_assign_string();
  292. Xextern int apm_convert();
  293. Xextern int apm_garbage_collect();
  294. Xextern FILE *apm_debug_file();
  295. Xextern int (*apm_error_func())();
  296. Xextern int apm_calc();
  297. Xextern APM apm_op_alloc();
  298. Xextern int apm_get_register();
  299. Xextern int apm_set_register();
  300. X
  301. X/*
  302. X * Calculator operation codes.
  303. X */
  304. X#define APM_CALC_ABS    (-1)
  305. X#define APM_CALC_NEG    (-2)
  306. X#define APM_CALC_RECIP    (-3)
  307. X#define APM_CALC_ADD    (-4)
  308. X#define APM_CALC_SUB    (-5)
  309. X#define APM_CALC_MUL    (-6)
  310. X#define APM_CALC_DIV    (-7)
  311. X#define APM_CALC_CLEAR    (-8)
  312. X#define APM_CALC_DUP    (-9)
  313. X#define APM_CALC_SWAP    (-10)
  314. X#define APM_CALC_SCALE    (-11)
  315. X#define APM_CALC_PUSH    (-12)
  316. X#define APM_CALC_POP    (-13)
  317. X
  318. X/*
  319. X * Macros
  320. X */
  321. X
  322. X#define APM_FUNC_INFO_(X)    (APM_file = __FILE__, APM_line = __LINE__, APM_func_name = (X))
  323. X
  324. X#define apmInit(X,Y,Z)        (APM_FUNC_INFO_("apmInit"),\
  325. X                 apm_init((X),(Y),(Z)))
  326. X#define apmNew(X)        (APM_FUNC_INFO_("apmNew"),\
  327. X                 apm_init(0L, 0, (X)))
  328. X#define apmDispose(X)        (APM_FUNC_INFO_("apmDispose"),\
  329. X                 apm_dispose((X)))
  330. X#define apmAdd(X,Y,Z)        (APM_FUNC_INFO_("apmAdd"),\
  331. X                 apm_add((X),(Y),(Z)))
  332. X#define apmSubtract(X,Y,Z)    (APM_FUNC_INFO_("apmSubtract"),\
  333. X                 apm_subtract((X),(Y),(Z)))
  334. X#define apmMultiply(X,Y,Z)    (APM_FUNC_INFO_("apmMultiply"),\
  335. X                 apm_multiply((X),(Y),(Z)))
  336. X#define apmDivide(V,W,X,Y,Z)    (APM_FUNC_INFO_("apmDivide"),\
  337. X                 apm_divide((V),(W),(X),(Y),(Z)))
  338. X#define apmCompare(X,Y)        (APM_FUNC_INFO_("apmCompare"),\
  339. X                 apm_compare((X),(Y)))
  340. X#define apmCompareLong(W,X,Y,Z)    (APM_FUNC_INFO_("apmCompareLong"),\
  341. X                 apm_compare_long((W),(X),(Y),(Z)))
  342. X#define apmSign(X)        (APM_FUNC_INFO_("apmSign"),\
  343. X                 apm_sign((X)))
  344. X#define apmAbsoluteValue(X,Y)    (APM_FUNC_INFO_("apmAbsoluteValue"),\
  345. X                 apm_absolute_value((X),(Y)))
  346. X#define apmNegate(X,Y)        (APM_FUNC_INFO_("apmNegate"),\
  347. X                 apm_negate((X),(Y)))
  348. X#define apmReciprocal(X,Y,Z)    (APM_FUNC_INFO_("apmReciprocal"),\
  349. X                 apm_reciprocal((X),(Y),(Z)))
  350. X#define apmScale(X,Y,Z)        (APM_FUNC_INFO_("apmScale"),\
  351. X                 apm_scale((X),(Y),(Z)))
  352. X#define apmRound(X,Y,Z)        (APM_FUNC_INFO_("apmRound"),\
  353. X                 apm_round((X),(Y),(Z)))
  354. X#define apmValidate(X)        (APM_FUNC_INFO_("apmValidate"),\
  355. X                 apm_validate((X)))
  356. X#define apmAssign(X,Y)        (APM_FUNC_INFO_("apmAssign"),\
  357. X                 apm_assign((X),(Y)))
  358. X#define apmAssignLong(W,X,Y,Z)    (APM_FUNC_INFO_("apmAssignLong"),\
  359. X                 apm_assign_long((W),(X),(Y),(Z)))
  360. X#define apmAssignString(X,Y,Z)    (APM_FUNC_INFO_("apmAssignString"),\
  361. X                 apm_assign_string((X),(Y),(Z)))
  362. X#define apmConvert(U,V,W,X,Y,Z)    (APM_FUNC_INFO_("apmConvert"),\
  363. X                 apm_convert((U),(V),(W),(X),(Y),(Z)))
  364. X#define apmGarbageCollect()    (APM_FUNC_INFO_("apmGarbageCollect"),\
  365. X                 apm_garbage_collect())
  366. X#define apmGetRegister(X,Y)    (APM_FUNC_INFO_("apmGetRegister"),\
  367. X                 apm_get_register((X),(Y)))
  368. X#define apmSetRegister(X,Y,Z)    (APM_FUNC_INFO_("apmSetRegister"),\
  369. X                 apm_set_register((X),(Y),(Z)))
  370. X
  371. X#define apmErrorFunc(X)        apm_error_func(X)
  372. X#define apmDebugFile(X)        apm_debug_file(X)
  373. X#define apmCalc            apm_calc
  374. X
  375. X#define APM_ABS            apm_op_alloc(APM_CALC_ABS, 0)
  376. X#define APM_NEG            apm_op_alloc(APM_CALC_NEG, 0)
  377. X#define APM_RECIP(N)        apm_op_alloc(APM_CALC_RECIP,(N))
  378. X#define APM_ADD            apm_op_alloc(APM_CALC_ADD, 0)
  379. X#define APM_SUB            apm_op_alloc(APM_CALC_SUB, 0)
  380. X#define APM_MUL            apm_op_alloc(APM_CALC_MUL, 0)
  381. X#define APM_DIV(N)        apm_op_alloc(APM_CALC_DIV, (N))
  382. X#define APM_CLEAR        apm_op_alloc(APM_CALC_CLEAR, 0)
  383. X#define APM_DUP            apm_op_alloc(APM_CALC_DUP, 0)
  384. X#define APM_SWAP        apm_op_alloc(APM_CALC_SWAP, 0)
  385. X#define APM_SCALE(N)        apm_op_alloc(APM_CALC_SCALE, (N))
  386. X#define APM_PUSH(N)        apm_op_alloc(APM_CALC_PUSH, (N))
  387. X#define APM_POP(N)        apm_op_alloc(APM_CALC_POP, (N))
  388. X
  389. X/*
  390. X * APM error codes (for apm_errno):  errors are < 0, warnings are > 0.
  391. X */
  392. X#define APM_OK        0    /* no error */
  393. X
  394. X#define APM_WNULL    1    /* one or more arguments are null */
  395. X#define APM_WDIVBYZERO    2    /* division by zero (yields 0) */
  396. X#define APM_WTRUNC    3    /* result truncated */
  397. X#define APM_WNOALLOC    4    /* attempt to free unallocated apm value */
  398. X
  399. X#define APM_ENOMEM    (-1)    /* no memory (allocation failed) */
  400. X#define APM_EPARM    (-2)    /* invalid parameter passed to function */
  401. X#define APM_ENULL    (-3)    /* null APM value */
  402. X#define APM_EBADVAL    (-4)    /* APM points to bad data */
  403. X#define APM_ENULLVAL    (-5)    /* null (non-APM) value */
  404. X#define APM_EFMT    (-6)    /* string is of invalid format */
  405. X#define APM_EBASE    (-7)    /* invalid base */
  406. X#define APM_ESIZE    (-8)    /* size of destination is too low */
  407. X#define APM_EOVERLAP    (-9)    /* result overlaps one or more operands */
  408. X
  409. X#endif /* ! APM_H_INCLUDED */
  410. @\END_OF_FILE_apm.h
  411. else
  412.   echo "shar: Will not over write apm.h"
  413. fi
  414. if `test ! -s apmlocal.h`
  415. then
  416. echo "x - apmlocal.h"
  417. sed 's/^X//' > apmlocal.h << '@\END_OF_FILE_apmlocal.h'
  418. X/******************************************************************************
  419. X
  420. X    Arbitrary Precision Math Library General Public License
  421. X            (Written October 5, 1988)
  422. X
  423. X Copyright (C) 1988 Lloyd Zusman, Master Byte Software, Los
  424. X Gatos, California.  Everyone is permitted to copy and distribute
  425. X verbatim copies of this license, but changing it is not allowed.
  426. X You can also use this wording to make the terms for other programs.
  427. X
  428. X The wording of this license is based on that of the
  429. X "GNU EMACS GENERAL PUBLIC LICENSE" by Richard Stallman,
  430. X Copyright (C) 1985, 1987, 1988, version of February 11, 1988,
  431. X but since some of the text has been changed, please be sure to
  432. X READ THIS CAREFULLY!
  433. X
  434. X  This general public license is intended to give everyone the right
  435. Xto share the Arbitrary Precision Math Library (hereinafter referred to
  436. Xas the "APM Library").  To make sure that you get the rights we want
  437. Xyou to have, I need to make restrictions that forbid anyone to deny
  438. Xyou these rights or to ask you to surrender the rights.
  439. X
  440. X  Specifically, we want to make sure that you have the right to give
  441. Xaway copies of the APM Library, that you receive source code or else
  442. Xcan get it if you want it, that you can change the APM Library or use
  443. Xpieces of it in new programs, and that you know you can do these
  444. Xthings.
  445. X
  446. X  To make sure that everyone has such rights, we have to forbid you to
  447. Xdeprive anyone else of these rights.  For example, if you distribute
  448. Xcopies of the APM Library, you must give the recipients all the
  449. Xrights that you have.  You must make sure that they, too, receive or
  450. Xcan get the source code.  And you must tell them their rights.
  451. X
  452. X  Also, for our own protection, we must make certain that everyone
  453. Xfinds out that there is no warranty for the APM Library.  If the APM
  454. XLibrary is modified by someone else and passed on, we want its
  455. Xrecipients to know that what they have is not what we distributed, so
  456. Xthat any problems introduced by others will not reflect on our
  457. Xreputation.
  458. X
  459. X  Therefore we (Lloyd Zusman and Master Byte Software) make the
  460. Xfollowing terms which say what you must do to be allowed to
  461. Xdistribute or change the APM Library.
  462. X
  463. X            COPYING POLICIES
  464. X
  465. X1. You may copy and distribute verbatim copies of the APM Library
  466. Xsource code as you receive it, in any medium, provided that you
  467. Xconspicuously and appropriately publish on each copy a valid copyright
  468. Xnotice "Copyright (C) 1988 Lloyd Zusman, Master Byte Software, Los
  469. XGatos, California" (or with whatever year is appropriate); keep intact
  470. Xthe notices on all files that refer to this License Agreement and to
  471. Xthe absence of any warranty; and give any other recipients of the the
  472. XAPM Library program a copy of this License Agreement along with the
  473. Xprogram.  You may charge a distribution fee for the physical act of
  474. Xtransferring a copy.
  475. X
  476. X  2. You may modify your copy or copies of the APM Library source code or
  477. Xany portion of it, and copy and distribute such modifications under
  478. Xthe terms of Paragraph 1 above, provided that you also do the following:
  479. X
  480. X    a) cause the modified files to carry prominent notices stating
  481. X    that you changed the files and the date of any change; and
  482. X
  483. X    b) cause the whole of any work that you distribute or publish, that in
  484. X    whole or in part contains or is a derivative of the APM Library or any
  485. X    part thereof, to be licensed to all third parties on terms identical
  486. X    to those contained in this License Agreement (except that you may
  487. X    choose to grant more extensive warranty protection to some or all
  488. X    third parties, at your option).
  489. X
  490. X    c) You may charge a distribution fee for the physical act of
  491. X    transferring a copy, and you may at your option offer warranty
  492. X    protection in exchange for a fee.
  493. X
  494. X    d) You may not charge a license fee for the whole of any work that
  495. X    you distribute or publish, that in whole or in part contains or is
  496. X    a derivative of the APM library or any part thereof, without the
  497. X    express written permission of Lloyd Zusman and Master Byte Software;
  498. X    whether this permission is granted for free or in return for goods
  499. X    services, royalties, or other compensation will be determined
  500. X    solely by Lloyd Zusman and Master Byte Software.
  501. X
  502. XMere aggregation of another unrelated program with this program (or its
  503. Xderivative) on a volume of a storage or distribution medium does not bring
  504. Xthe other program under the scope of these terms.
  505. X
  506. X  3. You may copy and distribute the APM Library (or a portion or
  507. Xderivative of it, under Paragraph 2) in object code or executable form
  508. Xunder all the terms of Paragraphs 1 and 2 above provided that you also
  509. Xdo one of the following:
  510. X
  511. X    a) accompany it with the complete corresponding machine-readable
  512. X    source code, which must be distributed under the terms of
  513. X    Paragraphs 1 and 2 above; or,
  514. X
  515. X    b) accompany it with a written offer, valid for at least three
  516. X    years, to give any third party free (except for a nominal
  517. X    shipping charge) a complete machine-readable copy of the
  518. X    corresponding source code, to be distributed under the terms of
  519. X    Paragraphs 1 and 2 above; or,
  520. X
  521. X    c) accompany it with the information you received as to where the
  522. X    corresponding source code may be obtained.  (This alternative is
  523. X    allowed only for noncommercial distribution and only if you
  524. X    received the program in object code or executable form alone.)
  525. X
  526. XFor an executable file, complete source code means all the source code
  527. Xfor all modules it contains; but, as a special exception, it need not
  528. Xinclude source code for modules which are standard libraries that
  529. Xaccompany the operating system on which the executable file runs.
  530. X
  531. X  4. You may not copy, sublicense, distribute or transfer the APM
  532. XLibrary except as expressly provided under this License Agreement.
  533. XAny attempt otherwise to copy, sublicense, distribute or transfer the
  534. XAPM Library is void and your rights to use the APM Library under this
  535. XLicense agreement shall be automatically terminated.  However, parties
  536. Xwho have received computer software programs from you with this
  537. XLicense Agreement will not have their licenses terminated so long as
  538. Xsuch parties remain in full compliance.
  539. X
  540. X  5. If you wish to incorporate parts of the APM Library into other
  541. Xprograms whose distribution conditions are different, write to Lloyd
  542. XZusman at Master Byte Software.  We have not yet worked out a simple
  543. Xrule that can be stated here, but we will often permit this.  We will
  544. Xbe guided by the goals of (1) preserving the free status of all
  545. Xderivatives of our free software; of (2) promoting the sharing and
  546. Xreuse of software; and of (3) not allowing anyone to profit from the
  547. Xuse of our software without us also having the opportunity to share
  548. Xin these profits.
  549. X
  550. XYour comments and suggestions about our licensing policies and our
  551. Xsoftware are welcome!  Please contact Lloyd Zusman, Master Byte
  552. XSoftware, 127 Wilder Ave., Los Gatos, California 95030, or call
  553. X(408) 395-5693.
  554. X
  555. X               NO WARRANTY
  556. X
  557. X  BECAUSE THE APM LIBRARY IS LICENSED FREE OF CHARGE, WE PROVIDE
  558. XABSOLUTELY NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE
  559. XLAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING, MASTER BYTE SOFTWARE,
  560. XLLOYD ZUSMAN AND/OR OTHER PARTIES PROVIDE THE APM LIBRARY "AS IS"
  561. XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  562. XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  563. XFITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  564. XAND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE THE APM
  565. XLIBRARY PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  566. XSERVICING, REPAIR OR CORRECTION.
  567. X
  568. X  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL MASTER BYTE
  569. XSOFTWARE, LLOYD ZUSMAN, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND
  570. XREDISTRIBUTE THE APM LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
  571. XDAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL,
  572. XINCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  573. XINABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  574. XBEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
  575. XFAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
  576. XMASTER BYTE SOFTWARE) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF
  577. XTHE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  578. X
  579. X******************************************************************************/
  580. X
  581. X
  582. X/*
  583. X * Non-exported header file for the APM library.
  584. X *
  585. X * $Log:    apmlocal.h,v $
  586. X * Revision 1.0  88/10/05  12:38:10  ljz
  587. X * Initial release.
  588. X * 
  589. X */
  590. X
  591. X#ifndef APMLOCAL_H_INCLUDED
  592. X#define APMLOCAL_H_INCLUDED
  593. X
  594. X#define APM_MAGIC    0xdeafc0de
  595. X#define OP_MAGIC    0xcacaface
  596. X
  597. X#define SPECIAL_BASE    10000
  598. X#define SPECIAL_SCALE    4
  599. X
  600. X#define SIGNOF(X)    ((X) < 0 ? -1 : 1)
  601. X
  602. X#ifdef MSDOS
  603. X# define TABINCR        8
  604. X#else
  605. X# define TABINCR        32
  606. X#endif /* MSDOS */
  607. X
  608. X#define APM_STACK_SIZE        16
  609. X#define APM_NUM_REGISTERS    16
  610. X
  611. X#define ERR_RETURN(X)    {int Q=(X);if(Q<APM_OK)return(APM_error(Q));}
  612. X#define APM_ASSERT(X)    if(!(X)){fprintf(stderr, "%s: %d: assertion failed: X\n", __FILE__, __LINE__);abort();}
  613. X
  614. Xextern int (*APM_error_func)();
  615. X
  616. Xextern int APM_calc_op();
  617. Xextern int APM_calc_unop();
  618. Xextern int APM_calc_binop();
  619. Xextern int APM_calc_misc();
  620. Xextern int APM_push();
  621. Xextern int APM_pop();
  622. X
  623. Xextern short APM_array_add();
  624. Xextern short APM_array_sub();
  625. Xextern short APM_scalar_mul();
  626. Xextern int APM_scalar_div();
  627. Xextern int APM_error();
  628. Xextern char *APM_alloc_mem();
  629. Xextern int APM_free_mem();
  630. Xextern char *APM_trim_string();
  631. Xextern char *APM_left_justify();
  632. Xextern int APM_val_format();
  633. Xextern int APM_val_base();
  634. Xextern short APM_get_digit();
  635. Xextern int APM_radix_pos();
  636. Xextern int APM_trim();
  637. Xextern int APM_trimlead();
  638. Xextern int APM_trimtrail();
  639. Xextern int APM_setdp();
  640. Xextern int APM_normalize();
  641. Xextern int APM_scale();
  642. Xextern APM APM_alloc();
  643. Xextern APM APM_do_alloc();
  644. Xextern int APM_free();
  645. Xextern int APM_do_free();
  646. Xextern int APM_norm_to_spec();
  647. Xextern int APM_spec_to_norm();
  648. Xextern int APM_size();
  649. Xextern int APM_parse_string();
  650. Xextern char *APM_build_string();
  651. Xextern int APM_parse_long();
  652. Xextern int APM_garbage_collect();
  653. Xextern int APM_copy_bytes();
  654. Xextern int APM_zero_bytes();
  655. Xextern int APM_copy_shorts();
  656. Xextern int APM_zero_shorts();
  657. Xextern char *APM_index();
  658. Xextern void APM_debug();
  659. Xextern void APM_calc_init();
  660. Xextern int APM_get_reg();
  661. Xextern int APM_set_reg();
  662. Xextern int APM_set_errno();
  663. X
  664. X#endif /* ! APMLOCAL_H_INCLUDED */
  665. @\END_OF_FILE_apmlocal.h
  666. else
  667.   echo "shar: Will not over write apmlocal.h"
  668. fi
  669. if `test ! -d test`
  670. then
  671.   mkdir test
  672.   echo "mkdir test"
  673. fi
  674. if `test ! -s test/Makefile`
  675. then
  676. echo "x - test/Makefile"
  677. sed 's/^X//' > test/Makefile << '@\END_OF_FILE_test/Makefile'
  678. XINCLUDES      = -I..
  679. X
  680. XCFLAGS        = -O $(INCLUDES)
  681. X
  682. XLDFLAGS          =
  683. X
  684. XLIBS          = ../libapm.a
  685. X
  686. XLINKER          = cc
  687. X
  688. XOBJS          = apmtest.o
  689. X
  690. XPROGRAM          = apmtest
  691. X
  692. XSRCS          = apmtest.c
  693. X
  694. Xall:        $(PROGRAM)
  695. X
  696. X$(PROGRAM):     $(OBJS) $(LIBS)
  697. X        $(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
  698. X
  699. Xclean:
  700. X        rm -f $(OBJS)
  701. X
  702. X# The 'depend' production assumes the use of a program called 'makedepend'.
  703. X# Change your 'depend' line accordingly.
  704. X
  705. Xdepend:
  706. X        makedepend $(INCLUDES) $(SRCS)
  707. X
  708. X# DO NOT DELETE THIS LINE -- makedepend uses it.
  709. X# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
  710. X
  711. Xapmtest.o: apmtest.c /usr/include/stdio.h /usr/include/setjmp.h ../apm.h
  712. X
  713. X# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
  714. @\END_OF_FILE_test/Makefile
  715. else
  716.   echo "shar: Will not over write test/Makefile"
  717. fi
  718. if `test ! -s test/makefile.msc`
  719. then
  720. echo "x - test/makefile.msc"
  721. sed 's/^X//' > test/makefile.msc << '@\END_OF_FILE_test/makefile.msc'
  722. XM          = S
  723. X
  724. XCFLAGS          = -A$(M) -DMSC -I.. -Ox
  725. X
  726. XLDFLAGS          = /noe/noi c:\ms\lib\arg$(M)+
  727. X
  728. XLIBS          = ..\apm.lib
  729. X
  730. XLINKER          = link
  731. X
  732. XSTACK         = 0800
  733. X
  734. XMINALLOC      = 0200
  735. X
  736. XMAKEFILE      = makefile
  737. X
  738. XPROGRAM          = apmtest.exe
  739. X
  740. XRESPFILE      = apmtest.arf
  741. X
  742. X
  743. X
  744. XSRCS          = apmtest.c
  745. X
  746. XOBJS          = apmtest.obj
  747. X
  748. X.c.obj:
  749. X    cl $(CFLAGS) -c $*.c
  750. X
  751. Xall:        $(PROGRAM)
  752. X
  753. X$(PROGRAM):     $(OBJS) $(LIBS)
  754. X        $(LINKER) $(LDFLAGS) @$(RESPFILE), $(PROGRAM), nul, $(LIBS);
  755. X        exemod $(PROGRAM) /stack $(STACK) /min $(MINALLOC)
  756. X
  757. Xclean:
  758. X        rm -f $(OBJS)
  759. X
  760. Xinstall:    $(PROGRAM)
  761. X        cp $(PROGRAM) $(DEST)
  762. X
  763. X###
  764. Xapmtest.obj: c:/ms/include/stdio.h c:/ms/include/setjmp.h ../apm.h \
  765. X    c:/ms/include/malloc.h
  766. @\END_OF_FILE_test/makefile.msc
  767. else
  768.   echo "shar: Will not over write test/makefile.msc"
  769. fi
  770. if `test ! -s test/apmtest.c`
  771. then
  772. echo "x - test/apmtest.c"
  773. sed 's/^X//' > test/apmtest.c << '@\END_OF_FILE_test/apmtest.c'
  774. X#include <stdio.h>
  775. X#include <setjmp.h>
  776. X#include "apm.h"
  777. X
  778. Xextern void exit();
  779. Xextern long strtol();
  780. Xextern long time();
  781. X
  782. X#ifndef MSC
  783. Xextern char *malloc();
  784. Xextern char *realloc();
  785. Xextern void free();
  786. X#endif /* ! MSC */
  787. X
  788. X#ifdef MSDOS
  789. X# define STRING_SIZE    512
  790. X#else
  791. X# define STRING_SIZE    8192
  792. X#endif /* MSDOS */
  793. X
  794. Xjmp_buf here;
  795. X
  796. X/*
  797. X * System-independent replacement for index() and strchr().
  798. X */
  799. Xchar *
  800. Xsindex(s, ch)
  801. Xchar *s;
  802. Xint ch;
  803. X{
  804. X    if (s != NULL) {
  805. X        for (; *s != '\0'; ++s) {
  806. X            if (*s == (char)ch) {
  807. X                return (s);
  808. X            }
  809. X        }
  810. X    }
  811. X    return (NULL);
  812. X}
  813. X
  814. Xint
  815. XerrorHandler(error, message, file, line, func)
  816. Xint error;
  817. Xchar *message;
  818. Xchar *file;
  819. Xint line;
  820. Xchar *func;
  821. X{
  822. X    fprintf(stderr, "\"%s\": line %d: %s: %s %d: %s\n",
  823. X        file, line, func, error < 0 ? "error" : "warning",
  824. X        error, message);
  825. X    if (error < 0) {
  826. X        longjmp(here, 1);
  827. X    }
  828. X    else {
  829. X        return (error);
  830. X    }
  831. X}
  832. X
  833. Xvoid
  834. Xusage()
  835. X{
  836. X    fprintf(stderr, "usage: apm [base]\n");
  837. X    exit(1);
  838. X}
  839. X
  840. Xmain(argc, argv)
  841. Xint argc;
  842. Xchar **argv;
  843. X{
  844. X    APM apm;
  845. X    APM other;
  846. X    APM result;
  847. X    APM remainder;
  848. X    char *cp;
  849. X    char *x;
  850. X    int ercode;
  851. X    int scaleFactor;
  852. X    int n;
  853. X    int outLen;
  854. X    int outDp;
  855. X    int leftjust = 0;
  856. X    int columnlist = 0;
  857. X    short base = -1;
  858. X
  859. X    for (--argc, ++argv; argc > 0; --argc, ++argv) {
  860. X        if (base > -1) {
  861. X            usage();
  862. X        }
  863. X        base = (short)strtol(*argv, &cp, 10);
  864. X    }
  865. X
  866. X    if (argc > 0) {
  867. X        usage();
  868. X    }
  869. X
  870. X    if (base == -1) {
  871. X        base = 0;
  872. X    }
  873. X
  874. X    apmDebugFile(stderr);
  875. X    (void)apmErrorFunc(errorHandler);
  876. X
  877. X    if (setjmp(here) != 0) {
  878. X        exit (1);
  879. X    }
  880. X
  881. X    x = malloc(STRING_SIZE + 1);
  882. X
  883. X    if (x == NULL) {
  884. X        fprintf(stderr, "not enough memory\n");
  885. X        exit(1);
  886. X    }
  887. X
  888. X    apm = apmNew(0);
  889. X    other = apmNew(0);
  890. X    result = apmNew(0);
  891. X    remainder = apmNew(0);
  892. X
  893. X    for (;;) {
  894. X        setjmp(here);
  895. X/***
  896. X        apmGarbageCollect();
  897. X***/
  898. X        fprintf(stderr, "\nEnter first number:\t");
  899. X        fflush(stderr);
  900. X        if (fgets(x, STRING_SIZE, stdin) == NULL) {
  901. X            break;
  902. X        }
  903. X        cp = sindex(x, '\n');
  904. X        if (cp != NULL) {
  905. X            *cp = '\0';
  906. X        }
  907. X        if (x[0] == '\0') {
  908. X            apmAssign(apm, result);
  909. X        }
  910. X        else {
  911. X            apmAssignString(apm, x, base);
  912. X        }
  913. X
  914. X        fprintf(stderr, "Enter second number:\t");
  915. X        fflush(stderr);
  916. X        if (fgets(x, STRING_SIZE, stdin) == NULL) {
  917. X            break;
  918. X        }
  919. X        cp = sindex(x, '\n');
  920. X        if (cp != NULL) {
  921. X            *cp = '\0';
  922. X        }
  923. X        if (x[0] == '\0') {
  924. X            apmAssign(other, result);
  925. X        }
  926. X        else {
  927. X            apmAssignString(other, x, base);
  928. X        }
  929. X
  930. X        fprintf(stderr, "Enter scale factor:\t");
  931. X        fflush(stderr);
  932. X        if(fgets(x, STRING_SIZE, stdin) == NULL) {
  933. X            break;
  934. X        }
  935. X        cp = sindex(x, '\n');
  936. X        if (cp != NULL) {
  937. X            *cp = '\0';
  938. X        }
  939. X        scaleFactor = (int)strtol(x, &cp, 10);
  940. X        if (cp == x) {
  941. X            scaleFactor = 0;
  942. X        }
  943. X
  944. X        fprintf(stderr, "Enter field width:\t");
  945. X        fflush(stderr);
  946. X        if(fgets(x, STRING_SIZE, stdin) == NULL) {
  947. X            break;
  948. X        }
  949. X        cp = sindex(x, '\n');
  950. X        if (cp != NULL) {
  951. X            *cp = '\0';
  952. X        }
  953. X        outLen = (int)strtol(x, &cp, 10);
  954. X        if (cp == x) {
  955. X            outLen = 32;
  956. X        }
  957. X
  958. X        fprintf(stderr, "Enter number of DP's:\t");
  959. X        fflush(stderr);
  960. X        if(fgets(x, STRING_SIZE, stdin) == NULL) {
  961. X            break;
  962. X        }
  963. X        cp = sindex(x, '\n');
  964. X        if (cp != NULL) {
  965. X            *cp = '\0';
  966. X        }
  967. X        outDp = (int)strtol(x, &cp, 10);
  968. X        if (cp == x) {
  969. X            outDp = 10;
  970. X        }
  971. X
  972. X        n = apmCompare(apm, other);
  973. X        if (n < 0) {
  974. X            cp = "<";
  975. X        }
  976. X        else if (n > 0) {
  977. X            cp = ">";
  978. X        }
  979. X        else {
  980. X            cp = "==";
  981. X        }
  982. X        fprintf(stderr, "  Comparison:\t\tfirst %s second\n", cp);
  983. X
  984. X/*
  985. X        apmNegate(result, apm);
  986. X*/
  987. X        apmCalc(result, apm, APM_NEG, NULL);
  988. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  989. X        if (columnlist) {
  990. X            fprintf(stderr, "\t\t\t12345678901234567890123456789012345678901234567890123456789012345678901234567890\n");
  991. X        }
  992. X        fprintf(stderr, "  Negation of first:\t%s\n", x);
  993. X
  994. X        cp = NULL;
  995. X/*
  996. X        apmReciprocal(result, outDp, other);
  997. X*/
  998. X        apmCalc(result, other, APM_RECIP(outDp), NULL);
  999. X        if (apm_errno == APM_WDIVBYZERO) {
  1000. X            cp = " (division by zero)";
  1001. X        }
  1002. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  1003. X        fprintf(stderr, "  Reciprocal of second:\t%s%s\n", x,
  1004. X            cp == NULL ? "" : cp);
  1005. X
  1006. X/*
  1007. X        apmAdd(result, apm, other);
  1008. X*/
  1009. X        apmCalc(result, apm, other, APM_ADD, NULL);
  1010. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  1011. X        fprintf(stderr, "  Sum:\t\t\t%s\n", x);
  1012. X
  1013. X/*
  1014. X        apmSubtract(result, apm, other);
  1015. X*/
  1016. X        apmCalc(result, apm, other, APM_SUB, NULL);
  1017. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  1018. X        fprintf(stderr, "  Difference:\t\t%s\n", x);
  1019. X
  1020. X/*
  1021. X        apmMultiply(result, apm, other);
  1022. X*/
  1023. X        apmCalc(result, apm, other, APM_MUL, NULL);
  1024. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  1025. X        fprintf(stderr, "  Product:\t\t%s\n", x);
  1026. X
  1027. X        cp = NULL;
  1028. X/*
  1029. X        apmDivide(result, outDp, remainder, apm, other);
  1030. X*/
  1031. X        apmCalc(result, apm, other, APM_DIV(outDp), NULL);
  1032. X        apmGetRegister(remainder, 0);
  1033. X        if (apm_errno == APM_WDIVBYZERO) {
  1034. X            cp = " (division by zero)";
  1035. X        }
  1036. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  1037. X        fprintf(stderr, "  Quotient:\t\t%s%s\n", x,
  1038. X            cp ? cp : "");
  1039. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, remainder);
  1040. X        fprintf(stderr, "  Remainder:\t\t%s\n", x);
  1041. X
  1042. X/*
  1043. X        apmScale(apm, result, scaleFactor);
  1044. X*/
  1045. X        apmCalc(apm, apm, APM_POP(1), result, APM_SCALE(scaleFactor),
  1046. X            NULL);
  1047. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, apm);
  1048. X        fprintf(stderr, "  Scaled quotient:\t%s\n", x);
  1049. X
  1050. X        apmCalc(result, APM_PUSH(1), APM_DUP, APM_ADD, APM_DUP,
  1051. X            other, APM_MUL, APM_SUB, NULL);
  1052. X        apmConvert(x, outLen + 1, outDp, 0, leftjust, result);
  1053. X        fprintf(stderr, "  Calc test:\t\t%s\n", x);
  1054. X
  1055. X    }
  1056. X    putchar('\n');
  1057. X}
  1058. @\END_OF_FILE_test/apmtest.c
  1059. else
  1060.   echo "shar: Will not over write test/apmtest.c"
  1061. fi
  1062. echo "Finished archive 5 of 5"
  1063. # to concatenate archives, remove anything after this line
  1064. exit 0
  1065.